package com.hunktimes.wholesale.vm

import androidx.lifecycle.MutableLiveData
import com.hunktimes.wholesale.base.BaseViewModel
import com.hunktimes.wholesale.extension.launch
import com.hunktimes.wholesale.net.WholeSaleRepository

/**
 * Author: Delete
 * Date: 2020/8/12 10:42
 * Description:
 *
 */
class CartVM : BaseViewModel() {

    val cartGoodsResult = MutableLiveData<List<String>>()

    val recommendsResult = MutableLiveData<List<String>>()

    fun getCartGoods() {
        launch({
            val resp = WholeSaleRepository.getCartGoods()
            val cartGoods = resp.data
            cartGoods?.let {
                cartGoodsResult.value = it
            }
        })
    }

    fun getCartRecommends() {
        launch({
            val resp = WholeSaleRepository.getCartRecommends()
            val cartGoods = resp.data
            cartGoods?.let {
                cartGoodsResult.value = it
            }
        })
    }
}